<!DOCTYPE html>





<html class="theme-next gemini" lang="zh-CN">
<head>
  <meta charset="UTF-8">
<meta name="generator" content="Hexo 3.9.0">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
  <link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=7.3.0">
  <link rel="icon" type="image/png" sizes="32x32" href="/images/CNY32x32.png?v=7.3.0">
  <link rel="icon" type="image/png" sizes="16x16" href="/images/CNY16x16.png?v=7.3.0">
  <link rel="mask-icon" href="/images/logo.svg?v=7.3.0" color="#222">

<link rel="stylesheet" href="/css/main.css?v=7.3.0">


<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css?v=4.7.0">


<script id="hexo-configurations">
  var NexT = window.NexT || {};
  var CONFIG = {
    root: '/',
    scheme: 'Gemini',
    version: '7.3.0',
    exturl: false,
    sidebar: {"position":"left","display":"post","offset":12,"onmobile":false},
    back2top: {"enable":true,"sidebar":false,"scrollpercent":true},
    save_scroll: false,
    copycode: {"enable":true,"show_result":true,"style":null},
    fancybox: false,
    mediumzoom: false,
    lazyload: false,
    pangu: false,
    algolia: {
      appID: '',
      apiKey: '',
      indexName: '',
      hits: {"per_page":10},
      labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
    },
    localsearch: {"enable":true,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},
    path: 'search.xml',
    motion: {"enable":false,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
    translation: {
      copy_button: '复制',
      copy_success: '复制成功',
      copy_failure: '复制失败'
    }
  };
</script>

  <meta name="description" content="write命令功能：给用户发信息，以Ctrl+C结束，通信双方要求已登录。用法：wirte &amp;lt;用户名&amp;gt;执行权限：所有用户实例：在zhong这个用户下给root用户发信息在root用户中就可以看见了wall命令英文缩写：wirte all功能：发广播信息，所有登录用户都能收到执行权限：所有用户">
<meta name="keywords" content="Linux">
<meta property="og:type" content="article">
<meta property="og:title" content="Linux常用命令-网络命令">
<meta property="og:url" content="localhost:4000/2019/08/18/Linux常用命令-网络命令/index.html">
<meta property="og:site_name" content="钟浩伟的个人博客">
<meta property="og:description" content="write命令功能：给用户发信息，以Ctrl+C结束，通信双方要求已登录。用法：wirte &amp;lt;用户名&amp;gt;执行权限：所有用户实例：在zhong这个用户下给root用户发信息在root用户中就可以看见了wall命令英文缩写：wirte all功能：发广播信息，所有登录用户都能收到执行权限：所有用户">
<meta property="og:locale" content="zh-CN">
<meta property="og:image" content="https://zhong-blog.oss-cn-shenzhen.aliyuncs.com/blog/20190818212049.png!blog">
<meta property="og:image" content="https://zhong-blog.oss-cn-shenzhen.aliyuncs.com/blog/20190818212107.png!blog">
<meta property="og:image" content="https://zhong-blog.oss-cn-shenzhen.aliyuncs.com/blog/20190818220904.png!blog">
<meta property="og:image" content="https://zhong-blog.oss-cn-shenzhen.aliyuncs.com/blog/20190818221126.png!blog">
<meta property="og:image" content="https://zhong-blog.oss-cn-shenzhen.aliyuncs.com/blog/20190818223632.png!blog">
<meta property="og:updated_time" content="2019-08-18T14:49:44.079Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="Linux常用命令-网络命令">
<meta name="twitter:description" content="write命令功能：给用户发信息，以Ctrl+C结束，通信双方要求已登录。用法：wirte &amp;lt;用户名&amp;gt;执行权限：所有用户实例：在zhong这个用户下给root用户发信息在root用户中就可以看见了wall命令英文缩写：wirte all功能：发广播信息，所有登录用户都能收到执行权限：所有用户">
<meta name="twitter:image" content="https://zhong-blog.oss-cn-shenzhen.aliyuncs.com/blog/20190818212049.png!blog">
  <link rel="canonical" href="localhost:4000/2019/08/18/Linux常用命令-网络命令/">


<script id="page-configurations">
  // https://hexo.io/docs/variables.html
  CONFIG.page = {
    sidebar: "",
    isHome: false,
    isPost: true,
    isPage: false,
    isArchive: false
  };
</script>

  <title>Linux常用命令-网络命令 | 钟浩伟的个人博客</title>
  








  <noscript>
  <style>
  .use-motion .motion-element,
  .use-motion .brand,
  .use-motion .menu-item,
  .sidebar-inner,
  .use-motion .post-block,
  .use-motion .pagination,
  .use-motion .comments,
  .use-motion .post-header,
  .use-motion .post-body,
  .use-motion .collection-title { opacity: initial; }

  .use-motion .logo,
  .use-motion .site-title,
  .use-motion .site-subtitle {
    opacity: initial;
    top: initial;
  }

  .use-motion .logo-line-before i { left: initial; }
  .use-motion .logo-line-after i { right: initial; }
  </style>
</noscript>

</head>

<body itemscope itemtype="http://schema.org/WebPage" lang="zh-CN">

  <div class="container sidebar-position-left">
    <div class="headband"></div>

    <header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
      <div class="header-inner"><div class="site-brand-wrapper">
  <div class="site-meta">

    <div class="custom-logo-site-title">
      <a href="/" class="brand" rel="start">
        <span class="logo-line-before"><i></i></span>
        <span class="site-title">钟浩伟的个人博客</span>
        <span class="logo-line-after"><i></i></span>
      </a>
    </div>
        <p class="site-subtitle">欢迎光临</p>
      
  </div>

  <div class="site-nav-toggle">
    <button aria-label="切换导航栏">
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
      <span class="btn-bar"></span>
    </button>
  </div>
</div>


<nav class="site-nav">
  
  <ul id="menu" class="menu">
      
      
      
        
        <li class="menu-item menu-item-home">
      
    

    <a href="/" rel="section"><i class="menu-item-icon fa fa-fw fa-home"></i> <br>首页</a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-tags">
      
    

    <a href="/tags/" rel="section"><i class="menu-item-icon fa fa-fw fa-tags"></i> <br>标签</a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-categories">
      
    

    <a href="/categories/" rel="section"><i class="menu-item-icon fa fa-fw fa-th"></i> <br>分类</a>

  </li>
      
      
      
        
        <li class="menu-item menu-item-archives">
      
    

    <a href="/archives/" rel="section"><i class="menu-item-icon fa fa-fw fa-archive"></i> <br>归档</a>

  </li>
      <li class="menu-item menu-item-search">
        <a href="javascript:;" class="popup-trigger">
        
          <i class="menu-item-icon fa fa-search fa-fw"></i> <br>搜索</a>
      </li>
    
  </ul>

</nav>
  <div class="site-search">
    
  <div class="popup search-popup">
  <div class="search-header">
    <span class="search-icon">
      <i class="fa fa-search"></i>
    </span>
    <div class="search-input-wrapper">
      <input autocomplete="off" autocorrect="off" autocapitalize="none"
             placeholder="搜索..." spellcheck="false"
             type="text" id="search-input">
    </div>
    <span class="popup-btn-close">
      <i class="fa fa-times-circle"></i>
    </span>
  </div>
  <div id="search-result"></div>
</div>


  </div>
</div>
    </header>

    


    <main id="main" class="main">
      <div class="main-inner">
        <div class="content-wrap">
            

          <div id="content" class="content page-post-detail">
            

  <div id="posts" class="posts-expand">
    

  <article class="post post-type-normal" itemscope itemtype="http://schema.org/Article">
  
  
  
  <div class="post-block">
    <link itemprop="mainEntityOfPage" href="localhost:4000/2019/08/18/Linux常用命令-网络命令/">

    <span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
      <meta itemprop="name" content="钟浩伟">
      <meta itemprop="description" content="">
      <meta itemprop="image" content="/images/profile.jpg">
    </span>

    <span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
      <meta itemprop="name" content="钟浩伟的个人博客">
    </span>
      <header class="post-header">

        
          <h1 class="post-title" itemprop="name headline">Linux常用命令-网络命令

            
          </h1>
        

        <div class="post-meta">
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-calendar-o"></i>
              </span>
              <span class="post-meta-item-text">发表于</span>

              
                
              

              <time title="创建时间：2019-08-18 21:11:39" itemprop="dateCreated datePublished" datetime="2019-08-18T21:11:39+08:00">2019-08-18</time>
            </span>
          
            <span class="post-meta-item">
              <span class="post-meta-item-icon">
                <i class="fa fa-folder-o"></i>
              </span>
              <span class="post-meta-item-text">分类于</span>
              
                <span itemprop="about" itemscope itemtype="http://schema.org/Thing"><a href="/categories/运维/" itemprop="url" rel="index"><span itemprop="name">运维</span></a></span>

                
                
              
            </span>
          

          

        </div>
      </header>

    
    
    
    <div class="post-body" itemprop="articleBody">

      
        <h1 id="write命令"><a href="#write命令" class="headerlink" title="write命令"></a>write命令</h1><p>功能：给用户发信息，以<code>Ctrl</code>+<code>C</code>结束，通信双方要求已登录。</p><p>用法：wirte &lt;用户名&gt;</p><p>执行权限：所有用户</p><p>实例：</p><p>在<code>zhong</code>这个用户下给root用户发信息</p><p><img src="https://zhong-blog.oss-cn-shenzhen.aliyuncs.com/blog/20190818212049.png!blog" alt="20190818212049"></p><p>在root用户中就可以看见了</p><p><img src="https://zhong-blog.oss-cn-shenzhen.aliyuncs.com/blog/20190818212107.png!blog" alt="20190818212107"></p><h1 id="wall命令"><a href="#wall命令" class="headerlink" title="wall命令"></a>wall命令</h1><p>英文缩写：wirte all</p><p>功能：发广播信息，所有登录用户都能收到</p><p>执行权限：所有用户</p><a id="more"></a>










<p>用法：wall [message]</p>
<p>示例：</p>
<figure class="highlight coffeescript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><span class="line">[root@localhost ~]<span class="comment"># wall Hello </span></span><br><span class="line"></span><br><span class="line">Broadcast message <span class="keyword">from</span> root@localhost.localdomain (pts/<span class="number">2</span>) (Sun Aug <span class="number">18</span> <span class="number">21</span>:<span class="number">29</span>:<span class="number">41</span> <span class="number">2019</span>):</span><br><span class="line"></span><br><span class="line">Hello</span><br></pre></td></tr></table></figure>

<figure class="highlight coffeescript"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line">[zhong@localhost ~]$ </span><br><span class="line">Broadcast message <span class="keyword">from</span> root@localhost.localdomain (pts/<span class="number">2</span>) (Sun Aug <span class="number">18</span> <span class="number">21</span>:<span class="number">29</span>:<span class="number">41</span> <span class="number">2019</span>):</span><br><span class="line"></span><br><span class="line">Hello</span><br></pre></td></tr></table></figure>

<p>可以看到，发送者自己也能收到这个信息。</p>
<h1 id="ping命令"><a href="#ping命令" class="headerlink" title="ping命令"></a>ping命令</h1><p>功能：测试网络连通性</p>
<p>用法：ping [-c] [ip] </p>
<p>选项：<code>-c</code>指定发送次数</p>
<p>示例：</p>
<figure class="highlight routeros"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br></pre></td><td class="code"><pre><span class="line">[zhong@localhost ~]$<span class="built_in"> ping </span>www.baidu.com -c 4</span><br><span class="line">PING www.a.shifen.com (14.215.177.39) 56(84) bytes of data.</span><br><span class="line">64 bytes <span class="keyword">from</span> 14.215.177.39 (14.215.177.39): <span class="attribute">icmp_seq</span>=1 <span class="attribute">ttl</span>=128 <span class="attribute">time</span>=26.6 ms</span><br><span class="line">64 bytes <span class="keyword">from</span> 14.215.177.39 (14.215.177.39): <span class="attribute">icmp_seq</span>=2 <span class="attribute">ttl</span>=128 <span class="attribute">time</span>=32.5 ms</span><br><span class="line">64 bytes <span class="keyword">from</span> 14.215.177.39 (14.215.177.39): <span class="attribute">icmp_seq</span>=3 <span class="attribute">ttl</span>=128 <span class="attribute">time</span>=37.5 ms</span><br><span class="line">64 bytes <span class="keyword">from</span> 14.215.177.39 (14.215.177.39): <span class="attribute">icmp_seq</span>=4 <span class="attribute">ttl</span>=128 <span class="attribute">time</span>=32.4 ms</span><br><span class="line"></span><br><span class="line">--- www.a.shifen.com<span class="built_in"> ping </span>statistics ---</span><br><span class="line">4 packets transmitted, 4 received, 0% packet loss, time 3005ms</span><br><span class="line">rtt min/avg/max/mdev = 26.609/32.293/37.540/3.875 ms</span><br></pre></td></tr></table></figure>

<p>重点看丢包率<code>packet loss</code>，丢包率高则说明网络状况不佳。</p>
<h1 id="ifconfig"><a href="#ifconfig" class="headerlink" title="ifconfig"></a>ifconfig</h1><p>英文原意：interface configure</p>
<p>描述：查看和设置网卡信息</p>
<p>执行权限：root</p>
<p>语法：ifconfig 网卡名称  ip</p>
<h2 id="查看网卡信息"><a href="#查看网卡信息" class="headerlink" title="查看网卡信息"></a>查看网卡信息</h2><figure class="highlight tap"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br></pre></td><td class="code"><pre><span class="line">[zhong@localhost ~]$ ifconfig</span><br><span class="line">ens33: flags=4163&lt;UP,BROADCAST,RUNNING,MULTICAST&gt;  mtu 1500</span><br><span class="line">        inet 192.168.146.128  netmask 255.255.255.0  broadcast 192.168.146.255</span><br><span class="line">        inet6 fe80::487d:9db5:efb1:19b8  prefixlen<span class="number"> 64 </span> scopeid 0x20&lt;link&gt;</span><br><span class="line">        ether 00:0c:29:b5:b4:4c  txqueuelen<span class="number"> 1000 </span> (Ethernet)</span><br><span class="line">        RX packets<span class="number"> 7377 </span> bytes<span class="number"> 504286 </span>(492.4 KiB)</span><br><span class="line">        RX errors<span class="number"> 0 </span> dropped<span class="number"> 0 </span> overruns<span class="number"> 0 </span> frame 0</span><br><span class="line">        TX packets<span class="number"> 8791 </span> bytes<span class="number"> 14466799 </span>(13.7 MiB)</span><br><span class="line">        TX errors<span class="number"> 0 </span> dropped<span class="number"> 0 </span>overruns<span class="number"> 0 </span> carrier<span class="number"> 0 </span> collisions 0</span><br><span class="line"></span><br><span class="line">lo: flags=73&lt;UP,LOOPBACK,RUNNING&gt;  mtu 65536</span><br><span class="line">        inet 127.0.0.1  netmask 255.0.0.0</span><br><span class="line">        inet6 ::1  prefixlen<span class="number"> 128 </span> scopeid 0x10&lt;host&gt;</span><br><span class="line">        loop  txqueuelen<span class="number"> 1000 </span> (Local Loopback)</span><br><span class="line">        RX packets<span class="number"> 272 </span> bytes<span class="number"> 29576 </span>(28.8 KiB)</span><br><span class="line">        RX errors<span class="number"> 0 </span> dropped<span class="number"> 0 </span> overruns<span class="number"> 0 </span> frame 0</span><br><span class="line">        TX packets<span class="number"> 272 </span> bytes<span class="number"> 29576 </span>(28.8 KiB)</span><br><span class="line">        TX errors<span class="number"> 0 </span> dropped<span class="number"> 0 </span>overruns<span class="number"> 0 </span> carrier<span class="number"> 0 </span> collisions 0</span><br><span class="line"></span><br><span class="line">virbr0: flags=4099&lt;UP,BROADCAST,MULTICAST&gt;  mtu 1500</span><br><span class="line">        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255</span><br><span class="line">        ether 52:54:00:29:75:7b  txqueuelen<span class="number"> 1000 </span> (Ethernet)</span><br><span class="line">        RX packets<span class="number"> 0 </span> bytes<span class="number"> 0 </span>(0.0 B)</span><br><span class="line">        RX errors<span class="number"> 0 </span> dropped<span class="number"> 0 </span> overruns<span class="number"> 0 </span> frame 0</span><br><span class="line">        TX packets<span class="number"> 0 </span> bytes<span class="number"> 0 </span>(0.0 B)</span><br><span class="line">        TX errors<span class="number"> 0 </span> dropped<span class="number"> 0 </span>overruns<span class="number"> 0 </span> carrier<span class="number"> 0 </span> collisions 0</span><br></pre></td></tr></table></figure>

<p><code>ens33</code>是本机网卡，<code>inet addr</code>：当前网络ip地址</p>
<h1 id="last"><a href="#last" class="headerlink" title="last"></a>last</h1><p>功能：列出目前与过去登入系统的用户信息</p>
<p><img src="https://zhong-blog.oss-cn-shenzhen.aliyuncs.com/blog/20190818220904.png!blog" alt="20190818220904"></p>
<p>如果想知道用户的最后登录用户可以用<code>lastlog</code></p>
<p><img src="https://zhong-blog.oss-cn-shenzhen.aliyuncs.com/blog/20190818221126.png!blog" alt="20190818221126"></p>
<h1 id="traceroute"><a href="#traceroute" class="headerlink" title="traceroute"></a>traceroute</h1><p>描述：显示数据包到主机间的路径</p>
<p>用法：traceroute 服务器地址</p>
<figure class="highlight lsl"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br></pre></td><td class="code"><pre><span class="line">[root@ecs-s2-medium<span class="number">-2</span>-linux<span class="number">-20190722215607</span> ~]# traceroute www.baidu.com</span><br><span class="line">traceroute to www.baidu.com (<span class="number">180.101</span><span class="number">.49</span><span class="number">.12</span>), <span class="number">30</span> hops max, <span class="number">60</span> byte packets</span><br><span class="line"> <span class="number">1</span>  * * *</span><br><span class="line"> <span class="number">2</span>  * * *</span><br><span class="line"> <span class="number">3</span>  <span class="number">100.80</span><span class="number">.0</span><span class="number">.1</span> (<span class="number">100.80</span><span class="number">.0</span><span class="number">.1</span>)  <span class="number">7.387</span> ms *  <span class="number">7.234</span> ms</span><br><span class="line"> <span class="number">4</span>  * <span class="number">10.241</span><span class="number">.6</span><span class="number">.21</span> (<span class="number">10.241</span><span class="number">.6</span><span class="number">.21</span>)  <span class="number">8.529</span> ms  <span class="number">8.700</span> ms</span><br><span class="line"> <span class="number">5</span>  <span class="number">10.241</span><span class="number">.8</span><span class="number">.141</span> (<span class="number">10.241</span><span class="number">.8</span><span class="number">.141</span>)  <span class="number">10.065</span> ms *  <span class="number">9.837</span> ms</span><br><span class="line"> <span class="number">6</span>  * <span class="number">10.230</span><span class="number">.2</span><span class="number">.146</span> (<span class="number">10.230</span><span class="number">.2</span><span class="number">.146</span>)  <span class="number">1.128</span> ms  <span class="number">1.128</span> ms</span><br><span class="line"> <span class="number">7</span>  <span class="number">10.230</span><span class="number">.2</span><span class="number">.108</span> (<span class="number">10.230</span><span class="number">.2</span><span class="number">.108</span>)  <span class="number">9.665</span> ms  <span class="number">9.843</span> ms  <span class="number">9.932</span> ms</span><br><span class="line"> <span class="number">8</span>  <span class="number">10.230</span><span class="number">.2</span><span class="number">.42</span> (<span class="number">10.230</span><span class="number">.2</span><span class="number">.42</span>)  <span class="number">2.296</span> ms  <span class="number">3.847</span> ms  <span class="number">3.644</span> ms</span><br><span class="line"> <span class="number">9</span>  * <span class="number">10.1</span><span class="number">.128</span><span class="number">.65</span> (<span class="number">10.1</span><span class="number">.128</span><span class="number">.65</span>)  <span class="number">2.442</span> ms  <span class="number">2.725</span> ms</span><br><span class="line"><span class="number">10</span>  <span class="number">10.1</span><span class="number">.128</span><span class="number">.82</span> (<span class="number">10.1</span><span class="number">.128</span><span class="number">.82</span>)  <span class="number">2.841</span> ms * <span class="number">10.1</span><span class="number">.128</span><span class="number">.74</span> (<span class="number">10.1</span><span class="number">.128</span><span class="number">.74</span>)  <span class="number">2.760</span> ms</span><br><span class="line"><span class="number">11</span>  * * *</span><br><span class="line"><span class="number">12</span>  <span class="number">183.60</span><span class="number">.190</span><span class="number">.97</span> (<span class="number">183.60</span><span class="number">.190</span><span class="number">.97</span>)  <span class="number">7.199</span> ms <span class="number">183.60</span><span class="number">.190</span><span class="number">.101</span> (<span class="number">183.60</span><span class="number">.190</span><span class="number">.101</span>)  <span class="number">8.062</span> ms  <span class="number">8.015</span> ms</span><br><span class="line"><span class="number">13</span>  <span class="number">113.96</span><span class="number">.4</span><span class="number">.65</span> (<span class="number">113.96</span><span class="number">.4</span><span class="number">.65</span>)  <span class="number">4.938</span> ms *  <span class="number">4.298</span> ms</span><br><span class="line"><span class="number">14</span>  * <span class="number">202.97</span><span class="number">.54</span><span class="number">.238</span> (<span class="number">202.97</span><span class="number">.54</span><span class="number">.238</span>)  <span class="number">26.562</span> ms *</span><br><span class="line"><span class="number">15</span>  <span class="number">58.213</span><span class="number">.94</span><span class="number">.118</span> (<span class="number">58.213</span><span class="number">.94</span><span class="number">.118</span>)  <span class="number">32.441</span> ms  <span class="number">32.433</span> ms *</span><br><span class="line"><span class="number">16</span>  <span class="number">58.213</span><span class="number">.94</span><span class="number">.90</span> (<span class="number">58.213</span><span class="number">.94</span><span class="number">.90</span>)  <span class="number">29.217</span> ms * *</span><br><span class="line"><span class="number">17</span>  <span class="number">58.213</span><span class="number">.96</span><span class="number">.118</span> (<span class="number">58.213</span><span class="number">.96</span><span class="number">.118</span>)  <span class="number">32.847</span> ms <span class="number">58.213</span><span class="number">.96</span><span class="number">.94</span> (<span class="number">58.213</span><span class="number">.96</span><span class="number">.94</span>)  <span class="number">32.748</span> ms <span class="number">58.213</span><span class="number">.96</span><span class="number">.62</span> (<span class="number">58.213</span><span class="number">.96</span><span class="number">.62</span>)  <span class="number">28.098</span></span><br></pre></td></tr></table></figure>

<p>该命令会返回每个节点的延时，可以用此查看是哪个网络节点出现了问题。</p>
<h1 id="netstat命令"><a href="#netstat命令" class="headerlink" title="netstat命令"></a>netstat命令</h1><p>描述：显示网络相关信息</p>
<p>权限：所有用户</p>
<p>选项：</p>
<ul>
<li><code>-t</code> TCP协议</li>
<li><code>-u</code> UDP协议</li>
<li><code>-l</code>  监听</li>
<li><code>-r</code> 路由</li>
<li><code>-m</code> 显示ip地址和端口号</li>
</ul>
<p>例如：</p>
<p><code># netstat -tlun</code> 查看本机监听的端口</p>
<p><code># netstat -an</code> 查看本机所有的网络连接</p>
<p><code># netstat -rn</code> 查看本机路由表</p>
<p>例如：</p>
<figure class="highlight routeros"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br></pre></td><td class="code"><pre><span class="line">[root@localhost ~]# netstat -tun</span><br><span class="line">Active Internet connections (w/o servers)</span><br><span class="line">Proto Recv-Q Send-Q Local<span class="built_in"> Address </span>          Foreign<span class="built_in"> Address </span>        State      </span><br><span class="line">tcp        0      0 192.168.146.128:22      192.168.146.1:53249     ESTABLISHED</span><br><span class="line">tcp        0     36 192.168.146.128:22      192.168.146.1:54298     ESTABLISHED</span><br><span class="line">tcp        0      0 192.168.146.128:22      192.168.146.1:54280     ESTABLISHED</span><br></pre></td></tr></table></figure>

<p>通常这个命令用来与查看某个端口是否被占用，然后关闭</p>
<figure class="highlight perl"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><span class="line">netstat -anp |<span class="keyword">grep</span> 端口号</span><br><span class="line"><span class="keyword">kill</span> -<span class="number">9</span> 进程pid</span><br></pre></td></tr></table></figure>

<h1 id="setup"><a href="#setup" class="headerlink" title="setup"></a>setup</h1><p>描述：配置网络</p>
<p>执行权限：root</p>
<p>这个命令是红帽自带的配置命令。可以进入系统配置界面</p>
<p><img src="https://zhong-blog.oss-cn-shenzhen.aliyuncs.com/blog/20190818223632.png!blog" alt="20190818223632"></p>

    </div>

    
    
    
      
  <div class="popular-posts-header">相关文章推荐</div>
  <ul class="popular-posts">
    <li class="popular-posts-item">
      
      
      <div class="popular-posts-title"><a href="\2019\08\19\Linux-常用命令-关机重启命令\" rel="bookmark">Linux 常用命令-关机重启命令</a></div>
      
    </li>
  
    <li class="popular-posts-item">
      
      
      <div class="popular-posts-title"><a href="\2019\08\19\Vim常用操作\" rel="bookmark">Vim常用操作及使用技巧</a></div>
      
    </li>
  
  </ul>


    
    <div>
      
      <div>
    
        <div style="text-align:center;color: #ccc;font-size:14px;">-------------本文结束感谢您的阅读,如有疑问，请联系<a href="mailto:610596547@qq.com">610596547@qq.com</a>-------------</div>
    
</div>
      
    </div>
        
      

      <footer class="post-footer">
          
            
          
          <div class="post-tags">
            
              <a href="/tags/Linux/" rel="tag"># Linux</a>
            
          </div>
        

        

          <div class="post-nav">
            <div class="post-nav-next post-nav-item">
              
                <a href="/2019/08/17/linux常用命令-压缩解压命令/" rel="next" title="linux常用命令-压缩解压命令">
                  <i class="fa fa-chevron-left"></i> linux常用命令-压缩解压命令
                </a>
              
            </div>

            <span class="post-nav-divider"></span>

            <div class="post-nav-prev post-nav-item">
              
                <a href="/2019/08/19/CentOS上安装配置Python3-7/" rel="prev" title="CentOS上安装配置Python3.7">
                  CentOS上安装配置Python3.7 <i class="fa fa-chevron-right"></i>
                </a>
              
            </div>
          </div>
        
      </footer>
    
  </div>
  
  
  
  </article>

  </div>


          </div>
          

        </div>
          
  
  <div class="sidebar-toggle">
    <div class="sidebar-toggle-line-wrap">
      <span class="sidebar-toggle-line sidebar-toggle-line-first"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-middle"></span>
      <span class="sidebar-toggle-line sidebar-toggle-line-last"></span>
    </div>
  </div>

  <aside id="sidebar" class="sidebar">
    <div class="sidebar-inner">
        <ul class="sidebar-nav motion-element">
          <li class="sidebar-nav-toc sidebar-nav-active" data-target="post-toc-wrap">
            文章目录
          </li>
          <li class="sidebar-nav-overview" data-target="site-overview-wrap">
            站点概览
          </li>
        </ul>
      

      <div class="site-overview-wrap sidebar-panel">
        <div class="site-overview">

          <div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
    <img class="site-author-image" itemprop="image"
      src="/images/profile.jpg"
      alt="钟浩伟">
  <p class="site-author-name" itemprop="name">钟浩伟</p>
  <div class="site-description motion-element" itemprop="description"></div>
</div>
  <nav class="site-state motion-element">
      <div class="site-state-item site-state-posts">
        
          <a href="/archives/">
        
          <span class="site-state-item-count">44</span>
          <span class="site-state-item-name">日志</span>
        </a>
      </div>
    
      
      
      <div class="site-state-item site-state-categories">
        
          
            <a href="/categories/">
          
        
        
        
          
        
          
        
          
        
          
        
          
        
          
        
        <span class="site-state-item-count">6</span>
        <span class="site-state-item-name">分类</span>
        </a>
      </div>
    
      
      
      <div class="site-state-item site-state-tags">
        
          
            <a href="/tags/">
          
        
        
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
          
        
        <span class="site-state-item-count">15</span>
        <span class="site-state-item-name">标签</span>
        </a>
      </div>
    
  </nav>
  <div class="links-of-author motion-element">
      <span class="links-of-author-item">
      
      
        
      
      
        
      
        <a href="https://github.com/XiaoZhong233" title="GitHub &rarr; https://github.com/XiaoZhong233" rel="noopener" target="_blank"><i class="fa fa-fw fa-github"></i>GitHub</a>
      </span>
    
      <span class="links-of-author-item">
      
      
        
      
      
        
      
        <a href="mailto:601596547@qq.com" title="E-Mail &rarr; mailto:601596547@qq.com" rel="noopener" target="_blank"><i class="fa fa-fw fa-envelope"></i>E-Mail</a>
      </span>
    
      <span class="links-of-author-item">
      
      
        
      
      
        
      
        <a href="https://blog.csdn.net/weixin_41154636" title="CSDN &rarr; https://blog.csdn.net/weixin_41154636" rel="noopener" target="_blank"><i class="fa fa-fw fa-book"></i>CSDN</a>
      </span>
    
      <span class="links-of-author-item">
      
      
        
      
      
        
      
        <a href="http://profile.zhonghaowei.xyz/" title="Profile &rarr; http://profile.zhonghaowei.xyz/" rel="noopener" target="_blank"><i class="fa fa-fw fa-address-card-o"></i>Profile</a>
      </span>
    
  </div>



        </div>
      </div>
      <!--noindex-->
        <div class="post-toc-wrap motion-element sidebar-panel sidebar-panel-active">
          <div class="post-toc">

            
            
            
            

            
              <div class="post-toc-content"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#write命令"><span class="nav-number">1.</span> <span class="nav-text">write命令</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#wall命令"><span class="nav-number">2.</span> <span class="nav-text">wall命令</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#ping命令"><span class="nav-number">3.</span> <span class="nav-text">ping命令</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#ifconfig"><span class="nav-number">4.</span> <span class="nav-text">ifconfig</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#查看网卡信息"><span class="nav-number">4.1.</span> <span class="nav-text">查看网卡信息</span></a></li></ol></li><li class="nav-item nav-level-1"><a class="nav-link" href="#last"><span class="nav-number">5.</span> <span class="nav-text">last</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#traceroute"><span class="nav-number">6.</span> <span class="nav-text">traceroute</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#netstat命令"><span class="nav-number">7.</span> <span class="nav-text">netstat命令</span></a></li><li class="nav-item nav-level-1"><a class="nav-link" href="#setup"><span class="nav-number">8.</span> <span class="nav-text">setup</span></a></li></ol></div>
            

          </div>
        </div>
      <!--/noindex-->
      



    </div>
  </aside>
  <div id="sidebar-dimmer"></div>




      </div>
    </main>

    <footer id="footer" class="footer">
      <div class="footer-inner">
        <div class="copyright">&copy; <span itemprop="copyrightYear">2020</span>
  <span class="with-love" id="animate">
    <i class="fa fa-heart"></i>
  </span>
  <span class="author" itemprop="copyrightHolder">钟浩伟</span>
</div>


<div id="days"></div>
<div class="BbeiAn-info">
   	粤ICP备 -
    <a target="_blank" href="http://beian.miit.gov.cn" style="color:#f0d784"  rel="nofollow">粤ICP备19111001号-1</a> <!--a标签中增加nofollow属性，避免爬虫出站。-->| 
	<a target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=" style="color:#f0d784;text-decoration:none;padding-left:30px;background:url(https://s1.ax1x.com/2018/09/29/ilmwIH.png) no-repeat left center" rel="nofollow">粤公网安备 粤ICP备19111001号-1</a>	  <!--这里将图标作为了背景，以使得能和后面的文字在同一行-->
</div>

<script>
function show_date_time(){
    window.setTimeout("show_date_time()", 1000);
    BirthDay=new Date("08/15/2019 22:40:14");
    today=new Date();
    timeold=(today.getTime()-BirthDay.getTime());
    sectimeold=timeold/1000
    secondsold=Math.floor(sectimeold);
    msPerDay=24*60*60*1000
    e_daysold=timeold/msPerDay
    daysold=Math.floor(e_daysold);
    e_hrsold=(e_daysold-daysold)*24;
    hrsold=setzero(Math.floor(e_hrsold));
    e_minsold=(e_hrsold-hrsold)*60;
    minsold=setzero(Math.floor((e_hrsold-hrsold)*60));
    seconds=setzero(Math.floor((e_minsold-minsold)*60));
    document.getElementById('days').innerHTML="<p>小破站已运行 "+daysold+" 天 "+hrsold+" 小时 "+minsold+" 分 "+seconds+" 秒</p>";
}
function setzero(i) {
    if (i<10) {
        i="0" + i
    };
    return i;
}
show_date_time();
</script>

        








        
      </div>
    </footer>
      <div class="back-to-top">
        <i class="fa fa-arrow-up"></i>
          <span id="scrollpercent"><span>0</span>%</span>
        
      </div>

    

  </div>

  
  <script src="/lib/jquery/index.js?v=3.4.1"></script>

<script src="/js/utils.js?v=7.3.0"></script>

<script src="/js/schemes/pisces.js?v=7.3.0"></script>



<script src="/js/next-boot.js?v=7.3.0"></script>




  















  <script src="/js/local-search.js?v=7.3.0"></script>










<script>
if (document.querySelectorAll('pre.mermaid').length) {
  NexT.utils.getScript('//cdn.jsdelivr.net/npm/mermaid@8/dist/mermaid.min.js', () => {
    mermaid.initialize({
      theme: 'default',
      logLevel: 3,
      flowchart: { curve: 'linear' },
      gantt: { axisFormat: '%m/%d/%Y' },
      sequence: { actorMargin: 50 }
    });
  }, window.mermaid);
}
</script>




  

  

  


  
  <script src="/js/scrollspy.js?v=7.3.0"></script>
<script src="/js/post-details.js?v=7.3.0"></script>



  
  <script type="text/javascript" src="//cdn.bootcss.com/canvas-nest.js/1.0.0/canvas-nest.min.js"></script>
  
<script src="/live2dw/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2dw/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"log":false,"model":{"jsonPath":"/live2dw/assets/assets/hijiki.model.json"},"display":{"position":"right","width":150,"height":300},"mobile":{"show":false}});</script></body>
</html>
